import re

def update_yhd_sku(smzdm):
    m = re.search(r'\|2F(\d{8})\|', smzdm.remark)
    if m:
        smzdm.commodity_sku = m.group(1)
        smzdm.mall_url = 'http://item.yhd.com/item/%s' %m.group(1)
        if smzdm.mall_url: smzdm.active = True
    m = re.search(r'\|2F(\d{7})\|', smzdm.remark)
    if not smzdm.active and m:
        smzdm.commodity_sku = m.group(1)
        smzdm.mall_url = 'http://item.yhd.com/item/%s' %m.group(1)
        if smzdm.mall_url: smzdm.active = True
    m = re.search(r'\|2F(\d{6})\|', smzdm.remark)
    if not smzdm.active and m:
        smzdm.commodity_sku = m.group(1)
        smzdm.mall_url = 'http://item.yhd.com/item/%s' %m.group(1)
        if smzdm.mall_url: smzdm.active = True
    return smzdm
